package com.headwind.logistics.carrier.service.impl;

import com.headwind.logistics.carrier.dto.SimDto;
import com.headwind.logistics.carrier.mapper.SimMapper;
import com.headwind.logistics.carrier.service.inter.SimServiceInter;
import com.headwind.logistics.common.pojo.Car;
import com.headwind.logistics.common.pojo.Employee;
import com.headwind.logistics.common.pojo.Sim;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author QT
 * @Date 2020/7/27 9:42
 * @Version 1.0
 * @DESCRIPTION sim卡业务逻辑层接口
 */
@Service
public class SimServiceImpl implements SimServiceInter {
    //sim卡数据访问层
    @Resource
    private SimMapper simMapper;

    /**
     *  查询Sim卡数据和模糊查询并分页
     *  @param page 页码
     *  @param rows 行数
     * @return
     */
    @Override
    public List<SimDto> queryAllSim(String simCard,Integer page, Integer rows) {
        if (page != null){
            page = (page-1)*rows;
        }
        return simMapper.queryAllSim(simCard,page,rows);
    }

    /**
     * 修改Sim卡状态和领取时间
     * @param sim sim实体对象
     * @return
     */
    @Override
    public int updateStatusAndGetTime(Sim sim) {
        return simMapper.updateStatusAndGetTime(sim);
    }
    /**
     * 修改Sim卡状态
     * @param sim sim实体对象
     * @return
     */
    @Override
    public int updateStatus(Sim sim) {
        return simMapper.updateStatus(sim);
    }
    /**
     * 新增sim卡
     * @param sim
     * @return
     */
    @Override
    public int addSim(Sim sim) {
        return simMapper.addSim(sim);
    }

    /**
     * 查询所有车牌号
     * @return
     */
    @Override
    public List<Car> queryAllCarNumber() {
        return simMapper.queryAllCarNumber();
    }
    /**
     * 根据ID删除Sim信息
     * @param sim sim实体对象
     * @return
     */
    @Override
    public int deleteSim(Sim sim) {
        return simMapper.deleteSim(sim);
    }

}
